<?php
    namespace app\vote\Model;
    use think\Model;
    use think\Session;
    class Admin{
        public function find($id,$pwd){
            $result=db('root')->where(["rootid"=>['=',$id]])->find();
            if(!empty($result)){
                $re=db('root')->where(["rootid"=>['=',"$id"],"password"=>['=',"$pwd"]])->find();
                if(!empty($re)){
                    Session::set('user',"$id");
                    Session::set('password',"$pwd");
                    return "SUCCESS"; 
                }else{
                    //  密码错误
                    return "ERROR PASSWORD";
                }
                // dump($result);
            }else{
                // 没有该用户
                return "NONE";
            }
        }
    }

?>